{% extends "base.html" %}
{% block content %}
    <h1>User List</h1>
    <table>
        <thead>
            <tr>
                <th>ID</th>
                <th>Username</th>
                <th>Role</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            {% for user in users %}
                <tr>
                    <td>{{ user.id }}</td>
                    <td>{{ user.username }}</td>
                    <td>{{ user.role }}</td>
                    <td>
                        <a href="{{ url_for('edit_user', user_id=user.id) }}">Edit</a>
                        <form method="POST" action="{{ url_for('delete_user', user_id=user.id) }}" style="display: inline;">
                            <button type="submit" onclick="return confirm('Are you sure you want to delete this user?')">Delete</button>
                        </form>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
    <a href="{{ url_for('index') }}">Back to Home</a>
{% endblock %}